package lanqiao.demo;

import java.math.BigInteger;

/**
 * 斐波那契数列最大公约数
 */
public class Test3 {
    public static void main(String[] args) {
        BigInteger[] f = new BigInteger[2022];
        f[1] = BigInteger.ONE;
        f[2] = BigInteger.ONE;
        for (int i = 3; i < f.length; i++) {
            f[i] = f[i - 1].add(f[i - 2]);
        }
        BigInteger a = f[2020];
        BigInteger b = f[520];
        System.out.println(a.gcd(b));
    }
}
